﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Model
{
    public class MessageItem
    {
        private string authorName;
        private DateTime date;
        private int id;
        private string ip;
        private string messageText;

        public MessageItem()
        {
            this.id = -1;
            this.authorName = string.Empty;
            this.messageText = string.Empty;
            this.date = DateTime.Now;
            this.ip = string.Empty;
        }

        public MessageItem(int id, string authorName, string messageText, DateTime date, string ip)
        {
            this.ID = id;
            this.AuthorName = authorName;
            this.MessageText = messageText;
            this.Date = date;
            this.Ip = ip;
        }

        public string AuthorName
        {
            get
            {
                return this.authorName;
            }
            set
            {
                this.authorName = value;
            }
        }

        public DateTime Date
        {
            get
            {
                return this.date;
            }
            set
            {
                this.date = value;
            }
        }

        public int ID
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        public string Ip
        {
            get
            {
                return this.ip;
            }
            set
            {
                this.ip = value;
            }
        }

        public string MessageText
        {
            get
            {
                return this.messageText;
            }
            set
            {
                this.messageText = value.Replace("\r\n", "<br />");
            }
        }
    }
}
